package ref;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class AppCore {
    public static void main(String[] args) throws Exception{
        // TODO
        // 1. 通过反射得到 CustomerService 类的实例 c
        // 2. 调用实例 c 的 say 方法并正确看到结果
//        Class<?> C = Class.forName("ref.CustomerService");
//        Object c = C.newInstance();
//        Field service = C.getDeclaredField("service");
//        service.setAccessible(true);
//        Class<?> U = Class.forName("ref.UserService");
//        service.set(c, U.newInstance());
//
//        Method say = C.getMethod("say");
//        say.invoke(c);
        Class<?> Co = Class.forName("ref.CoreService");
        Object c = Co.newInstance();
        Field customerService = Co.getDeclaredField("customerService");
        Field orderService = Co.getDeclaredField("orderService");
        Field userService = Co.getDeclaredField("userService");
        Class<?> Cu = Class.forName("ref.CustomerService");
        Class.forName("");

        Method say = Co.getMethod("say");
        say.invoke(c);

    }

}
